<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<title>API: widget   scrollbar.js  (YUI Library)</title>

	<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css?stamp=1316139452.2" />
	<link rel="stylesheet" type="text/css" href="assets/api.css?stamp=1316139452.2" />

    <script type="text/javascript" src="assets/api-js?stamp=1316139452.2"></script>
    <script type="text/javascript" src="assets/ac-js?stamp=1316139452.2"></script>
</head>

<body id="yahoo-com">

<div id="doc3" class="yui-t2">
	<div id="hd">
        <h1><a href="http://developer.yahoo.com/yui/" title="g-javascript-lib">g-javascript-lib</a></h1>
        <h3>widget&nbsp; <span class="subtitle">1.0.0</span></h3>
        <a href="./index.html" title="g-javascript-lib">g-javascript-lib</a> 
            &gt; <a href="./module_widget.html" title="widget">widget</a>
                
                 &gt; scrollbar.js (source view) 
        <form onsubmit="return false">
            <div id="propertysearch">
                Search: <input autocomplete="off" id="searchinput" />
                <div id="searchresults">
                    &nbsp;
                </div>
            </div>
        </form>
	</div>

	<div id="bd">
		<div id="yui-main">
			<div class="yui-b">
            <form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form">
                <fieldset>
                    <legend>Filters</legend>
                <span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span>
                <span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span>
                <span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span>
                </fieldset>
            </form>

                    <div id="srcout">
                        <style>
                            #doc3 .classopts { display:none; }
                        </style>
<div class="highlight"><pre><span class="p">(</span><span class="kd">function</span><span class="p">(){</span>

	<span class="kd">var</span> <span class="nx">_scrollObject</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
	<span class="kd">var</span> <span class="nx">_scrollDir</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
	<span class="kd">var</span> <span class="nx">_scrollTimer</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
	<span class="kd">var</span> <span class="nx">_SCROLL_INTERVAL</span> <span class="o">=</span> <span class="mi">200</span><span class="p">;</span>
	<span class="kd">var</span> <span class="nx">_BTN_HEIGHT</span> <span class="o">=</span> <span class="mi">16</span><span class="p">;</span>
	<span class="kd">var</span> <span class="nx">_BTN_WIDTH</span> <span class="o">=</span> <span class="mi">16</span><span class="p">;</span>
	<span class="kd">var</span> <span class="nx">_BAR_MIN_SIZE</span> <span class="o">=</span> <span class="mi">16</span><span class="p">;</span>

	<span class="nx">ScrollBar</span> <span class="o">=</span> <span class="nx">G</span><span class="p">.</span><span class="nx">GClass</span><span class="p">(</span><span class="s1">&#39;Widget&#39;</span><span class="p">,</span> <span class="s1">&#39;ScrollBar&#39;</span><span class="p">,</span> <span class="nx">G</span><span class="p">.</span><span class="nx">Base</span><span class="p">.</span><span class="nx">EventListener</span><span class="p">);</span>

	<span class="nx">ScrollBar</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">__init</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">dir</span><span class="p">)</span> 
	<span class="p">{</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">__Base__EventListener__init</span><span class="p">();</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">dir</span> <span class="o">=</span> <span class="nx">dir</span><span class="p">;</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">total</span> <span class="o">=</span> <span class="mi">100</span><span class="p">;</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">span</span> <span class="o">=</span> <span class="mi">50</span><span class="p">;</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">offset</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">space</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">total</span> <span class="o">-</span> <span class="k">this</span><span class="p">.</span><span class="nx">span</span><span class="p">;</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">step</span> <span class="o">=</span> <span class="mi">20</span><span class="p">;</span>
	<span class="p">}</span>

	<span class="kd">var</span> <span class="nx">_scroll_on_timer</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
		<span class="k">if</span> <span class="p">(</span><span class="nx">_scrollObj</span><span class="p">)</span> <span class="p">{</span>
			<span class="k">if</span> <span class="p">(</span><span class="nx">_scrollDir</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
				<span class="nx">_scrollObj</span><span class="p">.</span><span class="nx">step_inc</span><span class="p">();</span>
			<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
				<span class="nx">_scrollObj</span><span class="p">.</span><span class="nx">step_dec</span><span class="p">();</span>
			<span class="p">}</span>
		<span class="p">}</span> 
	<span class="p">}</span>

	<span class="kd">var</span> <span class="nx">_scroll_end</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
		<span class="k">if</span> <span class="p">(</span><span class="nx">_scrollTimer</span><span class="p">)</span> <span class="p">{</span>
			<span class="nx">clearInterval</span><span class="p">(</span><span class="nx">_scrollTimer</span><span class="p">);</span>
			<span class="nx">_scrollTimer</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
		<span class="p">}</span>
		<span class="nx">_scrollObj</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
	<span class="p">}</span>

	<span class="nx">ScrollBar</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_on_drag</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">ev</span><span class="p">)</span> <span class="p">{</span>
		<span class="kd">var</span> <span class="nx">offset</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
		<span class="kd">var</span> <span class="nx">l</span> <span class="o">=</span> <span class="nx">ev</span><span class="p">[</span><span class="s1">&#39;left&#39;</span><span class="p">];</span>
		<span class="kd">var</span> <span class="nx">t</span> <span class="o">=</span> <span class="nx">ev</span><span class="p">[</span><span class="s1">&#39;top&#39;</span><span class="p">];</span>

		<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dir</span> <span class="o">==</span> <span class="s1">&#39;V&#39;</span><span class="p">)</span> <span class="p">{</span>
			<span class="kd">var</span> <span class="nx">total</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">divBody</span><span class="p">.</span><span class="nx">clientHeight</span><span class="p">;</span>
			<span class="kd">var</span> <span class="nx">span</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">bar</span><span class="p">.</span><span class="nx">em</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">;</span>

			<span class="k">if</span> <span class="p">(</span><span class="nx">total</span> <span class="o">==</span> <span class="nx">span</span><span class="p">)</span> <span class="p">{</span>
				<span class="nx">offset</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
			<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
				<span class="nx">offset</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">space</span> <span class="o">*</span> <span class="nx">t</span> <span class="o">/</span> <span class="p">(</span><span class="nx">total</span> <span class="o">-</span> <span class="nx">span</span><span class="p">);</span>
			<span class="p">}</span>
		<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
			<span class="kd">var</span> <span class="nx">total</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">divBody</span><span class="p">.</span><span class="nx">clientWidth</span><span class="p">;</span>
			<span class="kd">var</span> <span class="nx">span</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">bar</span><span class="p">.</span><span class="nx">em</span><span class="p">.</span><span class="nx">offsetWidth</span><span class="p">;</span>
			<span class="k">if</span> <span class="p">(</span><span class="nx">total</span> <span class="o">==</span> <span class="nx">span</span><span class="p">)</span> <span class="p">{</span>
				<span class="nx">offset</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
			<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
				<span class="nx">offset</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">space</span> <span class="o">*</span> <span class="nx">l</span> <span class="o">/</span> <span class="p">(</span><span class="nx">total</span> <span class="o">-</span> <span class="nx">span</span><span class="p">);</span>
			<span class="p">}</span>
		<span class="p">}</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">offset</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">floor</span><span class="p">(</span><span class="nx">offset</span> <span class="o">+</span> <span class="mf">0.5</span><span class="p">);</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">fire</span><span class="p">(</span><span class="s2">&quot;onscroll&quot;</span><span class="p">,</span> <span class="p">{</span><span class="s1">&#39;offset&#39;</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">offset</span><span class="p">,</span> <span class="s1">&#39;span&#39;</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">span</span><span class="p">,</span> <span class="s1">&#39;total&#39;</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">tltal</span><span class="p">});</span>
	<span class="p">}</span>

	<span class="nx">ScrollBar</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_resize_v</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> 
	<span class="p">{</span>
		<span class="kd">var</span> <span class="nx">h</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">divContainer</span><span class="p">.</span><span class="nx">clientHeight</span><span class="p">;</span>
		<span class="nx">h</span> <span class="o">-=</span> <span class="k">this</span><span class="p">.</span><span class="nx">btnLU</span><span class="p">.</span><span class="nx">em</span><span class="p">.</span><span class="nx">offsetHeight</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">btnRD</span><span class="p">.</span><span class="nx">em</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">;</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">divBody</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="nx">h</span><span class="p">;</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">reset</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">offset</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">span</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span>
	<span class="p">}</span>

	<span class="nx">ScrollBar</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_resize_h</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> 
	<span class="p">{</span>
		<span class="kd">var</span> <span class="nx">w</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">divContainer</span><span class="p">.</span><span class="nx">clientWidth</span><span class="p">;</span>
		<span class="nx">w</span> <span class="o">-=</span> <span class="k">this</span><span class="p">.</span><span class="nx">btnLU</span><span class="p">.</span><span class="nx">em</span><span class="p">.</span><span class="nx">offsetWidth</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">btnRD</span><span class="p">.</span><span class="nx">em</span><span class="p">.</span><span class="nx">offsetWidth</span><span class="p">;</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">divBody</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="nx">w</span><span class="p">;</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">reset</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">offset</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">span</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span>
	<span class="p">}</span>


	<span class="cm">/*</span>
<span class="cm">	 * Set how many to increase when the UP/Down was clicked.</span>
<span class="cm">	 */</span>
	<span class="nx">ScrollBar</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">set_step</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">step</span><span class="p">)</span> 
	<span class="p">{</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">step</span> <span class="o">=</span> <span class="nx">step</span><span class="p">;</span>
	<span class="p">}</span>

	<span class="cm">/*</span>
<span class="cm">	 */</span>
	<span class="nx">ScrollBar</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">reset</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">offset</span><span class="p">,</span> <span class="nx">span</span><span class="p">,</span> <span class="nx">total</span><span class="p">)</span> 
	<span class="p">{</span>

		<span class="k">if</span> <span class="p">(</span><span class="nx">span</span> <span class="o">&gt;</span> <span class="nx">total</span><span class="p">)</span>	<span class="nx">span</span> <span class="o">=</span> <span class="nx">total</span><span class="p">;</span>

		<span class="k">this</span><span class="p">.</span><span class="nx">total</span> <span class="o">=</span> <span class="nx">total</span><span class="p">;</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">span</span> <span class="o">=</span> <span class="nx">span</span><span class="p">;</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">space</span> <span class="o">=</span> <span class="nx">total</span> <span class="o">-</span> <span class="nx">span</span><span class="p">;</span>

		<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dir</span> <span class="o">==</span> <span class="s1">&#39;V&#39;</span><span class="p">)</span> <span class="p">{</span>
			<span class="kd">var</span> <span class="nx">h</span> <span class="o">=</span>  <span class="k">this</span><span class="p">.</span><span class="nx">divBody</span><span class="p">.</span><span class="nx">clientHeight</span> <span class="o">*</span> <span class="p">(</span><span class="nx">span</span> <span class="o">/</span> <span class="nx">total</span><span class="p">);</span>
			<span class="nx">h</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">floor</span><span class="p">(</span><span class="nx">h</span><span class="p">);</span>
			<span class="k">if</span> <span class="p">(</span><span class="nx">h</span> <span class="o">&lt;</span> <span class="nx">_BAR_MIN_SIZE</span><span class="p">)</span>	<span class="nx">h</span> <span class="o">=</span> <span class="nx">_BAR_MIN_SIZE</span><span class="p">;</span>
			<span class="k">this</span><span class="p">.</span><span class="nx">bar</span><span class="p">.</span><span class="nx">em</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="nx">h</span><span class="p">;</span>
		<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
			<span class="kd">var</span> <span class="nx">w</span> <span class="o">=</span>  <span class="k">this</span><span class="p">.</span><span class="nx">divBody</span><span class="p">.</span><span class="nx">clientWidth</span> <span class="o">*</span> <span class="p">(</span><span class="nx">span</span> <span class="o">/</span> <span class="nx">total</span><span class="p">);</span>
			<span class="nx">w</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">floor</span><span class="p">(</span><span class="nx">w</span><span class="p">);</span>
			<span class="k">if</span> <span class="p">(</span><span class="nx">w</span> <span class="o">&lt;</span> <span class="nx">_BAR_MIN_SIZE</span><span class="p">)</span>	<span class="nx">w</span> <span class="o">=</span> <span class="nx">_BAR_MIN_SIZE</span><span class="p">;</span>
			<span class="k">this</span><span class="p">.</span><span class="nx">bar</span><span class="p">.</span><span class="nx">em</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="nx">w</span><span class="p">;</span>
		<span class="p">}</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">set_offset</span><span class="p">(</span><span class="nx">offset</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>
	<span class="p">}</span>

	<span class="nx">ScrollBar</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">set_offset</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">offset</span><span class="p">,</span> <span class="nx">fireEv</span><span class="p">)</span> 
	<span class="p">{</span>
		<span class="k">if</span> <span class="p">((</span><span class="nx">offset</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">span</span><span class="p">)</span> <span class="o">&gt;</span> <span class="k">this</span><span class="p">.</span><span class="nx">total</span><span class="p">)</span> <span class="p">{</span>
			<span class="nx">offset</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">total</span> <span class="o">-</span> <span class="k">this</span><span class="p">.</span><span class="nx">span</span><span class="p">;</span>
		<span class="p">}</span>
		<span class="k">if</span> <span class="p">(</span><span class="nx">offset</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">)</span>		<span class="nx">offset</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">offset</span> <span class="o">=</span> <span class="nx">offset</span><span class="p">;</span>

		<span class="kd">var</span> <span class="nx">x</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
		<span class="kd">var</span> <span class="nx">y</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
		<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dir</span> <span class="o">==</span> <span class="s1">&#39;V&#39;</span><span class="p">)</span> <span class="p">{</span>
			<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">space</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
				<span class="nx">y</span> <span class="o">=</span> <span class="nx">offset</span> <span class="o">*</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">divBody</span><span class="p">.</span><span class="nx">clientHeight</span> <span class="o">-</span> <span class="k">this</span><span class="p">.</span><span class="nx">bar</span><span class="p">.</span><span class="nx">em</span><span class="p">.</span><span class="nx">offsetHeight</span><span class="p">)</span> <span class="o">/</span> <span class="k">this</span><span class="p">.</span><span class="nx">space</span><span class="p">;</span>
			<span class="p">}</span>
			<span class="k">this</span><span class="p">.</span><span class="nx">bar</span><span class="p">.</span><span class="nx">em</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">top</span> <span class="o">=</span> <span class="nx">y</span><span class="p">;</span>
		<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
			<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">space</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
				<span class="nx">x</span> <span class="o">=</span> <span class="nx">offset</span> <span class="o">*</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">divBody</span><span class="p">.</span><span class="nx">clientWidth</span> <span class="o">-</span> <span class="k">this</span><span class="p">.</span><span class="nx">bar</span><span class="p">.</span><span class="nx">em</span><span class="p">.</span><span class="nx">offsetWidth</span><span class="p">)</span> <span class="o">/</span> <span class="k">this</span><span class="p">.</span><span class="nx">space</span><span class="p">;</span>
			<span class="p">}</span>
			<span class="k">this</span><span class="p">.</span><span class="nx">bar</span><span class="p">.</span><span class="nx">em</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">left</span> <span class="o">=</span> <span class="nx">x</span><span class="p">;</span>
		<span class="p">}</span>

		<span class="k">if</span> <span class="p">(</span><span class="nx">fireEv</span><span class="p">)</span> <span class="p">{</span>
			<span class="k">this</span><span class="p">.</span><span class="nx">_on_drag</span><span class="p">({</span><span class="s1">&#39;top&#39;</span><span class="o">:</span> <span class="nx">y</span><span class="p">,</span> <span class="s1">&#39;left&#39;</span><span class="o">:</span> <span class="nx">x</span><span class="p">});</span>
		<span class="p">}</span>
	<span class="p">}</span>

	<span class="nx">ScrollBar</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">step_inc</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> 
	<span class="p">{</span>
		<span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">offset</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">step</span><span class="p">;</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">set_offset</span><span class="p">(</span><span class="nx">i</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
	<span class="p">}</span>

	<span class="nx">ScrollBar</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">step_dec</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> 
	<span class="p">{</span>

		<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">offset</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
			<span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">offset</span> <span class="o">-</span> <span class="k">this</span><span class="p">.</span><span class="nx">step</span><span class="p">;</span>
			<span class="k">this</span><span class="p">.</span><span class="nx">set_offset</span><span class="p">(</span><span class="nx">i</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
		<span class="p">}</span>
	<span class="p">}</span>

	<span class="nx">ScrollBar</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">render</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">em</span><span class="p">)</span> 
	<span class="p">{</span>

		<span class="kd">var</span> <span class="nx">container</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s1">&#39;div&#39;</span><span class="p">);</span>
		<span class="kd">var</span> <span class="nx">btnlu</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s1">&#39;div&#39;</span><span class="p">);</span>
		<span class="kd">var</span> <span class="nx">btnrd</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s1">&#39;div&#39;</span><span class="p">);</span>
		<span class="kd">var</span> <span class="nx">divmid</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s1">&#39;div&#39;</span><span class="p">);</span>
		<span class="kd">var</span> <span class="nx">divbar</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">createElement</span><span class="p">(</span><span class="s1">&#39;div&#39;</span><span class="p">);</span>

		<span class="nx">divmid</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">divbar</span><span class="p">);</span>
		<span class="nx">container</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">btnlu</span><span class="p">);</span>
		<span class="nx">container</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">divmid</span><span class="p">);</span>
		<span class="nx">container</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">btnrd</span><span class="p">);</span>
		<span class="nx">em</span><span class="p">.</span><span class="nx">appendChild</span><span class="p">(</span><span class="nx">container</span><span class="p">);</span>

		<span class="k">this</span><span class="p">.</span><span class="nx">divContainer</span> <span class="o">=</span> <span class="nx">container</span><span class="p">;</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">divBody</span> <span class="o">=</span> <span class="nx">divmid</span><span class="p">;</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">btnLU</span> <span class="o">=</span> <span class="nx">G</span><span class="p">(</span><span class="nx">btnlu</span><span class="p">);</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">btnRD</span> <span class="o">=</span> <span class="nx">G</span><span class="p">(</span><span class="nx">btnrd</span><span class="p">);</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">bar</span> <span class="o">=</span> <span class="nx">G</span><span class="p">(</span><span class="nx">divbar</span><span class="p">);</span>

		<span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">dir</span> <span class="o">==</span> <span class="s1">&#39;V&#39;</span><span class="p">)</span> <span class="p">{</span>
			<span class="nx">container</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;scrollv&quot;</span><span class="p">;</span>
			<span class="nx">btnlu</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;scrollv_up&quot;</span><span class="p">;</span>
			<span class="nx">btnrd</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;scrollv_down&quot;</span><span class="p">;</span>
			<span class="nx">divmid</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;scrollv_mid&quot;</span><span class="p">;</span>

			<span class="nx">o</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">G</span><span class="p">(</span><span class="nx">container</span><span class="p">);</span>
			<span class="nx">o</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">&quot;onresize&quot;</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">ev</span><span class="p">)</span> <span class="p">{</span>
				<span class="k">this</span><span class="p">.</span><span class="nx">_resize_v</span><span class="p">();</span>
			<span class="p">},</span> <span class="k">this</span><span class="p">);</span>

			<span class="k">this</span><span class="p">.</span><span class="nx">_resize_v</span><span class="p">();</span>
		<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
			<span class="nx">container</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;scrollh&quot;</span><span class="p">;</span>
			<span class="nx">btnlu</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;scrollh_left&quot;</span><span class="p">;</span>
			<span class="nx">btnrd</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;scrollh_right&quot;</span><span class="p">;</span>
			<span class="nx">divmid</span><span class="p">.</span><span class="nx">className</span> <span class="o">=</span> <span class="s2">&quot;scrollh_mid&quot;</span><span class="p">;</span>

			<span class="nx">o</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">G</span><span class="p">(</span><span class="nx">container</span><span class="p">);</span>
			<span class="nx">o</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">&quot;onresize&quot;</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">ev</span><span class="p">)</span> <span class="p">{</span>
				<span class="k">this</span><span class="p">.</span><span class="nx">_resize_h</span><span class="p">();</span>
			<span class="p">},</span> <span class="k">this</span><span class="p">);</span>
			<span class="k">this</span><span class="p">.</span><span class="nx">_resize_h</span><span class="p">();</span>
		<span class="p">}</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">bar</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">&quot;ondrag&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_on_drag</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>

		<span class="k">this</span><span class="p">.</span><span class="nx">btnRD</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">&quot;onmousedown&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_scroll_rd_start</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
		<span class="k">this</span><span class="p">.</span><span class="nx">btnLU</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">&quot;onmousedown&quot;</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_scroll_lu_start</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
		<span class="nx">G</span><span class="p">(</span><span class="nb">document</span><span class="p">).</span><span class="nx">bind</span><span class="p">(</span><span class="s2">&quot;onmouseup&quot;</span><span class="p">,</span> <span class="nx">_scroll_end</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
	<span class="p">}</span>

	<span class="nx">ScrollBar</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_scroll_rd_start</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> 
	<span class="p">{</span>
		<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">_scrollTimer</span><span class="p">)</span> <span class="p">{</span>
			<span class="nx">_scrollTimer</span> <span class="o">=</span> <span class="nx">setInterval</span><span class="p">(</span><span class="nx">_scroll_on_timer</span><span class="p">,</span> <span class="nx">_SCROLL_INTERVAL</span><span class="p">);</span>
		<span class="p">}</span>
		<span class="nx">_scrollDir</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
		<span class="nx">_scrollObj</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
	<span class="p">}</span>

	<span class="nx">ScrollBar</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">_scroll_lu_start</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> 
	<span class="p">{</span>
		<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">_scrollTimer</span><span class="p">)</span> <span class="p">{</span>
			<span class="nx">_scrollTimer</span> <span class="o">=</span> <span class="nx">setInterval</span><span class="p">(</span><span class="nx">_scroll_on_timer</span><span class="p">,</span> <span class="nx">_SCROLL_INTERVAL</span><span class="p">);</span>
		<span class="p">}</span>
		<span class="nx">_scrollDir</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
		<span class="nx">_scrollObj</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
	<span class="p">}</span>


	<span class="nx">G</span><span class="p">.</span><span class="nx">DOM</span><span class="p">.</span><span class="nx">Element</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">ScrollBar</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">dir</span><span class="p">)</span> <span class="p">{</span>
		<span class="nx">scb</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">ScrollBar</span><span class="p">(</span><span class="nx">dir</span><span class="p">);</span>
		<span class="nx">scb</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">em</span><span class="p">);</span>
		<span class="k">return</span> <span class="nx">scb</span><span class="p">;</span>
	<span class="p">}</span>
<span class="p">})()</span>
</pre></div>
                    </div>
			</div>
		</div>
		<div class="yui-b">
            <div class="nav">

                    <div id="moduleList" class="module">
                        <h4>Modules</h4>
                        <ul class="content">
                                <li class=""><a href="module_base.html" title="base">base</a></li>
                                <li class=""><a href="module_svg.html" title="svg">svg</a></li>
                                <li class=""><a href="module_test.html" title="test">test</a></li>
                                <li class=""><a href="module_utils.html" title="utils">utils</a></li>
                                <li class="selected"><a href="module_widget.html" title="widget">widget</a></li>
                        </ul>
                    </div>

                    <div id="classList" class="module">
                        <h4>Classes</h4>
                        <ul class="content">
                                <li class=""><a href="widget.DataGrid.html" title="widget.DataGrid">widget.DataGrid</a></li>
                                <li class=""><a href="Widget.TreeView.html" title="Widget.TreeView">Widget.TreeView</a></li>
                        </ul>
                    </div>

                    <div id="fileList" class="module">
                        <h4>Files</h4>
                        <ul class="content">        
                                <li class=""><a href="keycmd.js.html" title="keycmd.js">keycmd.js</a></li>
                                <li class=""><a href="listmenu.js.html" title="listmenu.js">listmenu.js</a></li>
                                <li class="selected"><a href="scrollbar.js.html" title="scrollbar.js">scrollbar.js</a></li>
                                <li class=""><a href="toolbar.js.html" title="toolbar.js">toolbar.js</a></li>
                                <li class=""><a href="treeview.js.html" title="treeview.js">treeview.js</a></li>
                        </ul>
                    </div>





            </div>
		</div>
	</div>
	<div id="ft">
        <hr />
        Copyright &copy; 2011 Yahoo! Inc. All rights reserved.
	</div>
</div>
<script type="text/javascript">
    ALL_YUI_PROPS = [{"url": "Widget.TreeView.html#method_add_node", "access": "", "host": "Widget.TreeView", "type": "method", "name": "add_node"}, {"url": "Widget.TreeView.html#method_clear", "access": "", "host": "Widget.TreeView", "type": "method", "name": "clear"}, {"url": "widget.DataGrid.html#method_clear_view", "access": "", "host": "widget.DataGrid", "type": "method", "name": "clear_view"}, {"url": "widget.DataGrid.html#method_current_page", "access": "", "host": "widget.DataGrid", "type": "method", "name": "current_page"}, {"url": "widget.DataGrid.html#method_first_page", "access": "", "host": "widget.DataGrid", "type": "method", "name": "first_page"}, {"url": "widget.DataGrid.html#method_go", "access": "", "host": "widget.DataGrid", "type": "method", "name": "go"}, {"url": "Widget.TreeView.html#method___init", "access": "", "host": "Widget.TreeView", "type": "method", "name": "__init"}, {"url": "widget.DataGrid.html#method_last_page", "access": "", "host": "widget.DataGrid", "type": "method", "name": "last_page"}, {"url": "widget.DataGrid.html#method_link_data", "access": "", "host": "widget.DataGrid", "type": "method", "name": "link_data"}, {"url": "Widget.TreeView.html#method_link_data", "access": "", "host": "Widget.TreeView", "type": "method", "name": "link_data"}, {"url": "widget.DataGrid.html#method_next_page", "access": "", "host": "widget.DataGrid", "type": "method", "name": "next_page"}, {"url": "widget.DataGrid.html#method_page_total", "access": "", "host": "widget.DataGrid", "type": "method", "name": "page_total"}, {"url": "widget.DataGrid.html#method_prev_page", "access": "", "host": "widget.DataGrid", "type": "method", "name": "prev_page"}, {"url": "Widget.TreeView.html#method_render", "access": "", "host": "Widget.TreeView", "type": "method", "name": "render"}, {"url": "widget.DataGrid.html#method_set_current", "access": "", "host": "widget.DataGrid", "type": "method", "name": "set_current"}, {"url": "Widget.TreeView.html#method_set_current", "access": "", "host": "Widget.TreeView", "type": "method", "name": "set_current"}, {"url": "widget.DataGrid.html#method_set_page_size", "access": "", "host": "widget.DataGrid", "type": "method", "name": "set_page_size"}, {"url": "Widget.TreeView.html#method_toggle_folder", "access": "", "host": "Widget.TreeView", "type": "method", "name": "toggle_folder"}];
</script>
</body>
</html>
